import type { ProductForm } from './model';

import type { ID, IDS, PageQuery } from '#/api/common';

import { requestClient } from '#/api/request';

/**
 * 属性列表
 * @param params
 */
export function attributeList(params?: PageQuery) {
  return requestClient.get(`/iot/thingModel/item/page`, { params });
}
/**
 * 新增属性
 * @param data
 */
export function saveAttribute(data: Partial<ProductForm>) {
  return requestClient.postWithMsg(`/iot/thingModel/item/add`, data);
}
/**
 * 修改属性
 * @param data
 */
export function updateAttribute(data: Partial<ProductForm>) {
  return requestClient.postWithMsg(`/iot/thingModel/item/update`, data);
}

/**
 * 属性详情
 * @param id
 */
export function getAttributeDetail(id: ID | IDS) {
  return requestClient.get(`/iot/thingModel/item/detail?id=${id}`);
}

/**
 * 删除属性
 * @param id
 * @returns
 */

export function removeAttribute(id: ID | IDS) {
  return requestClient.post(`/iot/thingModel/item/remove?id=${id}`);
}
